﻿<UserControl x:Class="ErikEJ.SqlCeToolbox.ToolWindows.SqlEditorControl"
             xmlns:local="clr-namespace:ErikEJ.SqlCeToolbox.ToolWindows"
             xmlns:dw="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:avalonedit="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit"
             xmlns:extToolkit="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
             xmlns:MyApp="clr-namespace:ErikEJ.SqlCeToolbox.ToolWindows"
             mc:Ignorable="d" 
             d:DesignHeight="309" d:DesignWidth="800"
             Name="SqlEditorWindow" Loaded="SqlEditorWindow_Loaded" GotFocus="SqlEditorControl_OnGotFocus" Focusable="True" >
    <UserControl.Resources>
    </UserControl.Resources>
    <DockPanel x:Name="dock1">
        <ToolBarTray x:Name="toolTray" DockPanel.Dock="Top">
            <ToolBar x:Name="toolBar1" ToolBarTray.IsLocked="True" ToolBar.OverflowMode="Never">
                <Button Name="NewButton" Click="NewButton_Click" ToolTip="New Query (Ctrl+N)" >
                    <StackPanel Orientation="Horizontal" >
                        <Image Height="16" Width="16" Source="../Resources/NewQuery.png" />
                    </StackPanel>
                </Button>
                <Button Name="OpenButton" Click="OpenButton_Click" ToolTip="Open (Ctrl+O)" >
                    <StackPanel Orientation="Horizontal" >
                        <Image Height="16" Width="16" Source="../Resources/Open_6529.png" />
                    </StackPanel>
                </Button>
                <Separator x:Name="sep4"></Separator>
                <Button Name="SaveButton" Click="SaveButton_Click" ToolTip="Save (Ctrl+S)" >
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="../Resources/save_16xLG.png" Height="16" Width="16" />
                    </StackPanel>
                </Button>
                <Button Name="SaveAsButton" Click="SaveAsButton_Click" >
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="../Resources/save_16xLG.png" Height="16" Width="16" />
                        <TextBlock Name="txtSaveAs" Margin="5,0,0,0">Save As..</TextBlock>
                    </StackPanel>
                </Button>
                <Separator></Separator>
                <Button Name="ExecuteButton" Click="ExecuteButton_Click" ToolTip="Execute (Ctrl+E)" >
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="../Resources/RunOutline.png" Height="16" Width="16" />
                    </StackPanel>
                </Button>
                <Button Name="ExecuteWithPlanButton" ToolTip="Execute statement(s) with Actual Execution Plan" Click="ExecuteWithPlanButton_Click" >
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="../Resources/Run.png" Height="16" Width="16" />
                    </StackPanel>
                </Button>
                <Button Name="EstimateButton" ToolTip="Display Estimated Execution Plan" Click="ShowPlanButton_Click">
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="../Resources/DecisionTree.png" Height="16" Width="16" />
                    </StackPanel>
                </Button>
                <Button Name="ParseButton" ToolTip="Parse" Click="ParseButton_Click">
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="../Resources/Checkmark.png" Height="16" Width="16" />
                    </StackPanel>
                </Button>
                <Separator></Separator>
                <Button Name="ExportButton" ToolTip="Save Results As Text" Click="ExportButton_Click" >
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="../Resources/Office_Excel_Application_16xLG.png" Height="16" Width="16" />
                    </StackPanel>
                </Button>
                <Separator></Separator>
                <Button Name="SearchButton" ToolTip="Search the text in the SQL editor" Click="SearchButton_Click" >
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="../Resources/Find_5650.png" Height="16" Width="16" />
                    </StackPanel>
                </Button>
                <Separator></Separator>
                <extToolkit:DropDownButton 
                    Background="Transparent" BorderThickness="0" BorderBrush="{x:Null}" 
                    x:Name="ddButton" Click="ddButton_Click" ToolTip="Options (Current Window)" Margin="0,1,0,-1">
                    <extToolkit:DropDownButton.Content>
                        <Image Height="20" Width="20" Stretch="None" Source="../Resources/gear_16xLG.png" />
                    </extToolkit:DropDownButton.Content>
                    <extToolkit:DropDownButton.DropDownContent>
                        <extToolkit:CheckListBox x:Name="chkOptions" DisplayMemberPath="Label" SelectedMemberPath="IsChecked" ItemSelectionChanged="chkOptions_ItemSelectionChanged" />
                    </extToolkit:DropDownButton.DropDownContent>
                </extToolkit:DropDownButton>
                <Button Name="Options" Click="Options_Click" ToolTip="Options" Padding="0,0,0,0" >
                    <Image Height="20" Width="20" Stretch="None" Source="../Resources/gear_16xLG.png"  />
                </Button>
            </ToolBar>
        </ToolBarTray>
        <Grid DockPanel.Dock="Right">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="22"/>
            </Grid.RowDefinitions>
            <Border Background="{StaticResource {x:Static SystemColors.WindowBrushKey}}">
                <avalonedit:TextEditor Margin="4" Name="SqlTextBox" FontFamily="Consolas" FontSize="14" ShowLineNumbers="False" />
            </Border>
            <GridSplitter Height="8" ResizeDirection="Rows" Grid.Row="0" HorizontalAlignment="Stretch" 
                    VerticalAlignment="Bottom"  />
            <Border Grid.Row="1"  Margin="0" Grid.Column="1" Background="{StaticResource {x:Static SystemColors.WindowBrushKey}}" >
                <TabControl x:Name="resultsTabControl">
                    <TabItem x:Name="tab1"  Header="Result">
                        <DockPanel x:Name="GridPanel"/>
                    </TabItem>
                    <TabItem x:Name="tab2" Header="Messages">
                        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
                            <DockPanel x:Name="Resultspanel" LastChildFill="False" />
                        </ScrollViewer>
                    </TabItem>
                </TabControl>
                
                <!--<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
                    <DockPanel Name="Resultspanel" LastChildFill="False" >
                        
                    </DockPanel>
                </ScrollViewer>-->
            </Border>
            <StatusBar Grid.Row="2">
                <StatusBar.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="4*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                        </Grid>
                    </ItemsPanelTemplate>
                </StatusBar.ItemsPanel>
                <StatusBarItem>
                    <TextBlock x:Name="txtTime">Duration: 00:00.000</TextBlock>
                </StatusBarItem>
                <StatusBarItem Grid.Column="1">
                    <TextBlock></TextBlock>
                </StatusBarItem>
                <StatusBarItem Grid.Column="2">
                    <TextBlock></TextBlock>
                </StatusBarItem>
                <StatusBarItem Grid.Column="3">
                    <TextBlock x:Name="txtVersion">4.0.0.0</TextBlock>
                </StatusBarItem>
            </StatusBar>
        </Grid>

    </DockPanel>
</UserControl>
